<template xmlns="http://www.w3.org/1999/html">
  <sea-dialog ref="dialog">
    <sea-data-table ref="tableObject" url="/schedule/log/page">
      <!--表头-->
      <sea-table-header slot="header">
        <!--标题栏-->
        <sea-table-title slot="title" title="标题" subtitle=""></sea-table-title>

        <!--按钮栏-->
        <template slot="buttons">
          <el-button plain size="small" title="新增" icon="fa fa-plus" @click="onAction('new')"></el-button>
        </template>
      </sea-table-header>

      <!-- 弹窗、抽屉 -->
      <panel slot="drawer" ref="panel"></panel>

      <!--表头-->
      <template slot="columns">
        <el-table-column property="jobName" label="任务名" width="180"></el-table-column>
        <el-table-column property="triggerName" label="触发器名称" width="180"></el-table-column>
        <el-table-column property="jobGroup" label="任务分组" width="180"></el-table-column>
        <el-table-column property="triggerGroup" label="触发器分组" width="180"></el-table-column>
        <el-table-column property="cron" label="表达式" width="180"></el-table-column>
        <el-table-column property="description" label="描述" width="180" show-overflow-tooltip></el-table-column>
        <el-table-column property="jobClass" label="计划任务类名" width="180" show-overflow-tooltip></el-table-column>
        <sea-col-switch property="disabled" label="是否禁用" width="180" :change="onAction"></sea-col-switch>

        <!--操作栏-->
        <sea-table-actionbar width="180" :on-action="onAction" :buttons="buttons"></sea-table-actionbar>
      </template>
    </sea-data-table>
  </sea-dialog>
</template>

<script>
import Panel from "./Panel";


export default {
    components: {Panel},
    data() {
        return {
            // 操作栏
            buttons: [
                {type: 'btn', evt: 'edit', label: '编辑', title: '编辑当前行'},
                {type: 'btn', evt: 'info', label: '查看', title: '查看当前行'},
                {type: 'divider'},
                {type: 'btn', evt: 'del', label: '删除', style: 'text-orange', title: '删除当前行'}
            ]
            // end--
        }
    },
    methods: {
        /**
         * 操作成功回调
         */
        onSucceed: function () {
            this.$refs.tableObject.reload();
        },
        /**
         * 操作栏事件分发
         * @param evt 事件
         * @param row 行级对象
         * @param old 可供回滚的参数
         */
        onAction: function (evt, row, old) {
            this.$refs.panel.onAction(evt, row, old);
        }
    }
}
</script>
